In a digital camera or the like, automatic white balance adjustment is performed so that the color of a subject that is white under a given source of light is reproduced as white. Available white balance adjustment methods include a method in which the balance of RGB components of a signal for each pixel is adjusted so that an average for an entire image represents an achromatic color. Also, there is another known technique in which an image is divided into a plurality of blocks, an average value of RGB components is calculated for each block, only one or more blocks whose average values are within a predetermined range are selected, and the RGB components are adjusted so that an average value of RGB components for a group of the selected blocks represents an achromatic color. Japanese Patent Laid-Open Publication No. 2000-92509 discloses a technique wherein an image is divided into a plurality of blocks, a representative value is calculated for each block, and representative values for all blocks are used to calculate white balance gain.
FIG. 10 is a block diagram showing a structure of a related art white balance adjustment device. An image capture device 10, such as a digital camera, outputs a captured digital image to a block dividing circuit 12. The block dividing circuit 12 equally divides an input image into a plurality of blocks. Each block contains “n by m” pixels. The block dividing circuit 12 sequentially outputs the blocks to a representative value calculating circuit 14. The representative value calculating circuit 14 calculates an average value of RGB components for n*m pixels constituting each block, and further calculates a representative value (Tl, Tg, Ti) based on the block average value using the following linear transformation:
                              (                                                    Tl                                                                    Tg                                                                    Ti                                              )                =                              (                                                                                1                    /                    4                                                                                        1                    /                    2                                                                                        1                    /                    4                                                                                                                                          -                      1                                        /                    4                                                                                        1                    /                    2                                                                                                              -                      1                                        /                    4                                                                                                                                          -                      1                                        /                    2                                                                    0                                                                      1                    /                    2                                                                        )                    ⁢                      (                                                            R                                                                              G                                                                              B                                                      )                                              (        1        )            where Tl represents the luminance of a block, and Tg and Ti represent the color difference of a block. The representative value calculating circuit 14 outputs the representative value (Tl, Tg, Ti) calculated for each block to a white balance evaluating circuit 16.
The white balance evaluating circuit 16 evaluates the reliabilities of the respective blocks, calculates weighting factors in accordance with the evaluated reliabilities, and outputs the weighting factors to a white balance gain calculating circuit 18. The white balance gain calculating circuit 18 calculates a white balance gain value by performing a weighted average using the representative values of the blocks, and the weighting factors calculated by the white balance evaluating circuit 16 based on the reliabilities of the blocks. More specifically, white balance gains are calculated by the following equations:
                              (                                                    RMix                                                                    GMix                                                                    BMix                                              )                =                              (                                                            1                                                                      -                    1                                                                                        -                    1                                                                                                1                                                                                                                                    ⁢                    1                                                                                                                                                      ⁢                    0                                                                                                1                                                                      -                    1                                                                                                                                                      ⁢                    1                                                                        )                    ⁢                      (                                                            TlMix                                                                              TgMix                                                                              TiMix                                                      )                                              (        2        )            MaxMix=max(RMix,GMix,BMix)  (3)Rgain=MaxMix/RmixGgain=MaxMix/GMixBgain=MaxMix/BMix  (4)where TlMix, TgMix, and TiMix represent weighted average values obtained from the representative values of the blocks. The value (RMix, GMix, BMix) calculated by the above equations represents the color of a light source illuminating the subject. The white balance gains Rgain, Ggain, and Bgain are adjusted so that the color obtained when light coming from an estimated light source is reflected from a white object is corrected to be gray (or, in other words, so that R=G=B is satisfied). The calculated gains are output from the white balance gain calculating circuit 18 to a white balance adjusting circuit 20. The white balance adjusting circuit 20 multiplies RGB values for each pixel included in an input image from the image capture device 10 by the respective gains calculated by the white balance gain calculating circuit 18, thereby adjusting the white balance of the image to output the result thereof.
However, the above-described related art technique has a problem in that, because a representative value for each block is obtained using the equation (1) based on an average value of RGB components calculated for all n*m pixels included in each block, when a certain color of an object existing within a block is different from the color of a light source, the average value of the block will be influenced by the color of this object.
As an example, FIG. 11 shows a block 100, which is one of a plurality of blocks divided from an image. The block 100 includes n*m pixels, and an average value of RGB components for all the pixels is calculated as the average value for this block. However, as shown in this figure, the block 100 includes an image 102 of a green leaf. In such a case, because the background color and the green color are averaged, the resultant average value does not accurately indicate the color of a light source illuminating the block. As a result, although the light source should be determined as daylight, the light source can be erroneously determined as a fluorescent lamp. As described, related art techniques do not always provide sufficient measures to estimate the color of an actual light source in cases where an object of a chromatic color is present within a block, or where a state within a block is not uniform (for such cases, although the reliability of each block can be used to reduce the unwanted influence, it is then necessary to accurately evaluate the reliability), which has been a factor causing reduced accuracy of white balance adjustment.
An objective of the present invention is to provide a device that is capable of performing white balance adjustment easily and reliably even in cases where an object of a chromatic color is present within a block, or where a state within a block is not uniform.